﻿using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Data.SqlClient;

namespace DiChanAPI.Controllers
{
    public class PingGuController : ApiController
    {
        // GET api/pinggu
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }
        #region  导入Excel表自动回填
        [HttpGet]
        [ActionName("GetBasic_InfoById")]
        public Basic_Info GetBasic_InfoById(string pronum)
        {
            SqlParameter[] par ={
                                    new  SqlParameter("@Basic_id",pronum),
                                };
            return new Basic_InfoBLL().GetBasicListById(par);

        }

        #endregion

        // GET api/pinggu/5
        public string Get(int id)
        {
            return "value";
        }
        #region  Post 评估
        [HttpPut]
        [ActionName("PutBasic_Info")]
        // POST api/index
        public bool PutBasic_Info([FromBody]Basic_Info info)
        {
            SqlParameter[] par ={
                                   new SqlParameter("@Basic_id",info.Basic_id),
                                   new SqlParameter("@Survey_StartTime",info.Survey_StartTime),
                                   new SqlParameter("@Survey_EndTime",info.Survey_EndTime),
                                   new SqlParameter("@Basic_Acreage",info.Basic_Acreage),
                                   new SqlParameter("@Basic_Enclosure",info.Basic_Enclosure),
                                   new SqlParameter("@Basic_Evaluation",info.Basic_Evaluation),
                                   new SqlParameter("@Basic_Excl",info.Basic_Excl),
                                   new SqlParameter("@Basic_Total",info.Basic_Total),
                                   new SqlParameter("@Basic_UnitPrice",info.Basic_UnitPrice),
                                   new SqlParameter("@Basic_ValueTime",info.Basic_ValueTime),
                               };
            return new Basic_InfoBLL().UpdateBasic(par);

        }
        #endregion
        // POST api/pinggu
        public void Post([FromBody]string value)
        {
        }

        // PUT api/pinggu/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/pinggu/5
        public void Delete(int id)
        {
        }
    }
}
